#include "EntryCMCollection.h"


EntryCMCollection::EntryCMCollection(void)
{
	capacity=10;
	liste=new EntryCM[capacity];
	size=0;
}

EntryCMCollection::~EntryCMCollection(void)
{
	delete []liste;
}

void EntryCMCollection::enlarge(int addSpace){
	capacity=size+addSpace;
	EntryCM *liste2=new EntryCM[capacity];
	*liste2=*liste;
	*liste=*liste2;
	delete[]liste2;
}

void EntryCMCollection::add(EntryCM e){
	if(capacity==size)
		EntryCMCollection::enlarge(10);
	liste[size]=e;
	size++;
}

void EntryCMCollection::remove(int e){
	for(int i=e;i<size;i++){
		liste[i]=liste[i+1];
	}
	size--;
	//std::cout << "Element entfernt: " << e << std::endl;
}

void EntryCMCollection::print(){

	std::cout << "Ausgabe der Messergebnisse:" << std::endl;
		std::cout << "_______________________" << std::endl;
	for(int i=0; i<size;i++)
	{
		std::cout << "Eintrag \t" << i+1 << std::endl; 
		std::cout << "KF: \t\t"<<  liste[i].getKF() << std::endl;
		std::cout << "RGF: \t\t" << liste[i].getRGF() << std::endl;
		std::cout << "SP_FRT: \t" << liste[i].getSP_FRT() << std::endl;
		std::cout << "FRT: \t\t" << liste[i].getFRT() << std::endl;
		std::cout << "ES:  \t\t" << liste[i].getES() << std::endl;
		std::cout << "PA: \t\t" << liste[i].getPA() << std::endl;
		std::cout << "LL: \t\t" << liste[i].getLL() << std::endl;
		std::cout << "SZ: \t\t" <<  liste[i].getSZ() << std::endl;
		std::cout<< "SM: \t\t" << liste[i].getSM()  << std::endl;
		/* std::cout << liste[i].getDateTime() <<std::endl; */
		std::cout << "************************************" << std::endl;
	}
}

int EntryCMCollection::length(){
	return size;
}

EntryCM &EntryCMCollection::getElement(int i){
	return liste[i];
}